package cn.ffcs.uec.outStaff.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import cn.ffcs.uec.common.vo.UecBdDefdoc;
import cn.ffcs.uec.outStaff.dao.UecOutStaffDao;
import cn.ffcs.uom.common.model.UomEntity;
import cn.ffcs.uom.common.util.ApplicationContextUtil;
import cn.ffcs.uom.common.util.StrUtil;
import lombok.Getter;
import lombok.Setter;
/**
 * 外包人员培训信息
 *
 */
public class UecOutStaffTramsg extends UomEntity implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6969345251188906091L;

	/**
	 *主键标识
	 * 
	 * @return
	 */
	public Long getTramsgId() {
		return super.getId();
	}

	public void setTramsgId(Long tramsgId) {
		super.setId(tramsgId);
	}
	/**
	 * 账期
	 */
	@Getter
	@Setter
	private Long monthId;
	@Getter
	@Setter
	private String pkPsnTramsg;
	@Getter
	@Setter
	private Long outStaffId;
	@Getter
	@Setter
	private String pkPsnMsg;
	@Getter
	@Setter
	private String traClass;
	@Getter
	@Setter
	private String traLevel;
	@Getter
	@Setter
	private String traAct;
	@Getter
	@Setter
	private String traCourse;
	@Getter
	@Setter
	private String begindate;
	@Getter
	@Setter
	private String enddate;
	@Getter
	@Setter
	private String traTime;
	@Getter
	@Setter
	private String traMode;
	@Getter
	@Setter
	private String traObjective;
	@Getter
	@Setter
	private String traLocation;
	@Getter
	@Setter
	private String traResult;
	@Getter
	@Setter
	private String certname;
	@Getter
	@Setter
	private String certunit;
	@Getter
	@Setter
	private String certcode;
	@Getter
	@Setter
	private String remark;
	@Getter
	@Setter
	private String ts;
	@Getter
	@Setter
	private Long dr;
	@Getter
	@Setter
	private String traCode;
	@Getter
	@Setter
	private String traMethod;
	@Getter
	@Setter
	private String traContent;
	@Getter
	@Setter
	private String traValidity;
	@Getter
	@Setter
	private String traSignDate;
	@Getter
	@Setter
	private String traHostUnit;
	@Getter
	@Setter
	private String traCoOrganizer;
	@Getter
	@Setter
	private String traUndertakingUnit;
	@Getter
	@Setter
	private Long traLeaEvaluationResults;
	@Getter
	@Setter
	private Long traPerformanceResults;
	@Getter
	@Setter
	private String traCertificateLevel;
	@Getter
	@Setter
	private String onlineUniversityPk;
	@Getter
	@Setter
	private String traHostUnitPk;
	@Getter
	@Setter
	private String traHostDeptPk;
	@Getter
	@Setter
	private String traCardUnitPk;
	@Getter
	@Setter
	private String traCardDeptPk;
	@Getter
	@Setter
	private String traFileUnitPk;
	@Getter
	@Setter
	private String traFileDeptPk;
	
	public static UecOutStaffTramsg newInstance() {
		return new UecOutStaffTramsg();
	}
	
	/**
	 * 获取dao
	 * 
	 * @return
	 */
	public UecOutStaffDao repository() {
		return (UecOutStaffDao) ApplicationContextUtil.getBean("uecOutStaffDao");
	}
	
	/**
	 * 获取培训类别--TRA_CLASS
	 */
	public String getTraClassName() {
		if (!StrUtil.isNullOrEmpty(this.getTraClass())) {
			String sql = " SELECT * FROM  UEC_BD_DEFDOC T WHERE T.PK_DEFDOC = ? ";
			List<Object> params = new ArrayList<Object>();
			params.add(this.getTraClass());
			List<UecBdDefdoc> list = this.repository().jdbcFindList(sql, params, UecBdDefdoc.class);
			if (list != null && list.size() > 0) {
				return list.get(0).getName();
			}
		}
		return "";
	}
	
	/**
	 * 获取培训方式--traMode
	 */
	public String getTraModeName() {
		if (!StrUtil.isNullOrEmpty(this.getTraMode())) {
			String sql = " SELECT * FROM  UEC_BD_DEFDOC T WHERE T.PK_DEFDOC = ? ";
			List<Object> params = new ArrayList<Object>();
			params.add(this.getTraMode());
			List<UecBdDefdoc> list = this.repository().jdbcFindList(sql, params, UecBdDefdoc.class);
			if (list != null && list.size() > 0) {
				return list.get(0).getName();
			}
		}
		return "";
	}
	
	/**
	 * 培训地点--traLocation
	 */
	public String getTraLocationName() {
		if (!StrUtil.isNullOrEmpty(this.getTraLocation())) {
			String sql = " SELECT * FROM  UEC_BD_DEFDOC T WHERE T.PK_DEFDOC = ? ";
			List<Object> params = new ArrayList<Object>();
			params.add(this.getTraLocation());
			List<UecBdDefdoc> list = this.repository().jdbcFindList(sql, params, UecBdDefdoc.class);
			if (list != null && list.size() > 0) {
				return list.get(0).getName();
			}
		}
		return "";
	}
	
	/**
	 * 获取参训方式--traMethod
	 */
	public String getTraMethodName() {
		if (!StrUtil.isNullOrEmpty(this.getTraMethod())) {
			String sql = " SELECT * FROM  UEC_BD_DEFDOC T WHERE T.PK_DEFDOC = ? ";
			List<Object> params = new ArrayList<Object>();
			params.add(this.getTraMethod());
			List<UecBdDefdoc> list = this.repository().jdbcFindList(sql, params, UecBdDefdoc.class);
			if (list != null && list.size() > 0) {
				return list.get(0).getName();
			}
		}
		return "";
	}
}
